import os

'''
    :param dirPath:String 源文件夹
    :param movePath:String 目标文件夹
    :param containWord:分类需要包含的单词
    :param type:分类的文件类型 0.不限制 1.文件 2.文件夹
'''


def classify(dirPath, movePath, containWord, type):
    fileList = os.listdir(dirPath)

    for i in fileList:
        fullPath = dirPath + i
        need = False

        if type == 0:
            need = True
        elif type == 1:
            need = os.path.isfile(fullPath)
        elif type == 2:
            need = os.path.isdir(fullPath)

        if (i.find(containWord) != -1) and need:
            os.rename(fullPath, movePath + "\\" + i)


if __name__ == '__main__':
    pass
